* (bug 25355) Parser generates edit section links for special pages.
* (bug 27894) Move 'editondblclick' event listener down from body to
div#bodyContent.
+* (bug 30172) The check for posix_isatty() in maintenance scripts did not detect
+ when the function exists but is disabled. Introduced Maintenance::posix_isatty()
=== API changes in 1.19 ===
* (bug 19838) siprop=interwikimap can now use the interwiki cache.
wfPHPVersionError( 'cli' );
}
-// Wrapper for posix_isatty()
-if ( !function_exists( 'posix_isatty' ) ) {
- # We default as considering stdin a tty (for nice readline methods)
- # but treating stout as not a tty to avoid color codes
- function posix_isatty( $fd ) {
- return !$fd;
- }
-}
-
/**
* Abstract maintenance class for quickly writing and churning out
* maintenance scripts with minimal effort. All that _must_ be defined
return $title;
}
+ /**
+ * Wrapper for posix_isatty()
+ * We default as considering stdin a tty (for nice readline methods)
+ * but treating stout as not a tty to avoid color codes
+ *
+ * @param $fd int File descriptor
+ * @return bool
+ */
+ public static function posix_isatty( $fd ) {
+ if ( !MWInit::functionExists( 'posix_isatty' ) ) {
+ return !$fd;
+ } else {
+ return posix_isatty( $fd );
+ }
+}
+
/**
* Prompt the console for input
* @param $prompt String what to begin the line with, like '> '
public static function readconsole( $prompt = '> ' ) {
static $isatty = null;
if ( is_null( $isatty ) ) {
- $isatty = posix_isatty( 0 /*STDIN*/ );
+ $isatty = self::posix_isatty( 0 /*STDIN*/ );
}
if ( $isatty && function_exists( 'readline' ) ) {
function importFromStdin() {
$file = fopen( 'php://stdin', 'rt' );
- if( posix_isatty( $file ) ) {
+ if( self::posix_isatty( $file ) ) {
$this->maybeHelp( true );
}
return $this->importFromHandle( $file );
*/
public function __construct( $options = array() ) {
# Only colorize output if stdout is a terminal.
- $this->color = !wfIsWindows() && posix_isatty( 1 );
+ $this->color = !wfIsWindows() && Maintenance::posix_isatty( 1 );
if ( isset( $options['color'] ) ) {
switch( $options['color'] ) {